<?php
/*
 * Load different ajax request
 */
class Common_LoaderController extends Zend_Controller_Action
{
    public $widgetService; //perform queries related to the widget info
    public function init()
    {
		$this->widgetService = new Clu_Service_Widget();
    }
    
    /*
     * Load widgets that are stored in session from previous master req
     */
	public function loadWidgetAction()
	{
		//load this request
		$ajaxWidgetSess = new Zend_Session_Namespace(AJAX_WIDGETS_NS);
//		$this->widgetService->setupViewNoLayout();

		$placeHolder = $this->_request->getParam('placeHolder');
		$widget = $ajaxWidgetSess->ajaxWidgets[$placeHolder];
		$widget['clu_no_layout'] = 1;
		//TODO: Do set up the full Layout here Just the view()
//		die_a($ajaxWidgetSess->paramsForWidgets);
		$this->widgetService->setupLayout($widget['template'], $widget['theme']);
		$this->widgetService->addWidget($widget, $ajaxWidgetSess->paramsForWidgets);
	}
	
	/*
	 * Load a widget dynamically
	 * info will be gotten straigt from widget_positions
	 * 
	 */
	public function reloadWidgetAction()
	{
		
	}
}
?>